refactor(tests): 🔧 Update test setup to use build script#171
Merged
Conversation
* Replaced `Set-BuildEnvironment` with a call to the build script in multiple test files. * This change standardizes the test environment setup across all test cases. * Allows easier testing with the Testing VS Code tool.
69c7bbd to
4d44468
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces Set-BuildEnvironment -Path "$PSScriptRoot/.." -Force with a direct call to build.ps1 -Task 'Build' in the BeforeAll block of 14 type-specific Pester test files, intended to standardize bootstrapping across tests and make the VS Code Testing tool able to run them.
Changes:
- Swaps
Set-BuildEnvironmentfor& "$PSScriptRoot\..\build.ps1" -Task 'Build'in 14Tests/*.Type.Tests.ps1files. - Keeps the
if (-not $env:BHProjectPath)guard so the setup runs only when env vars aren't already populated. - Does not touch
Tests/PSDepend.Tests.ps1,Tests/Help.tests.ps1, orTests/PSModuleGallery.Type.Tests.ps1, which use a different setup pattern.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Chocolatey.Type.Tests.ps1 | Switch to invoking build.ps1 -Task Build |
| Tests/Command.Type.Tests.ps1 | Same setup change |
| Tests/DotnetSdk.Type.Tests.ps1 | Same setup change |
| Tests/FileDownload.Type.Tests.ps1 | Same setup change |
| Tests/FileSystem.Type.Tests.ps1 | Same setup change |
| Tests/Git.Type.Tests.ps1 | Same setup change |
| Tests/GitHub.Type.Tests.ps1 | Same setup change |
| Tests/Noop.Type.Tests.ps1 | Same setup change |
| Tests/Npm.Type.Tests.ps1 | Same setup change |
| Tests/Nuget.Type.Tests.ps1 | Same setup change |
| Tests/Package.Type.Tests.ps1 | Same setup change |
| Tests/PSGalleryModule.Type.Tests.ps1 | Same setup change |
| Tests/PSGalleryNuget.Type.Tests.ps1 | Same setup change |
| Tests/Task.Type.Tests.ps1 | Same setup change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| BeforeAll { | ||
| if (-not $env:BHProjectPath) { | ||
| Set-BuildEnvironment -Path "$PSScriptRoot/.." -Force | ||
| & "$PSScriptRoot\..\build.ps1" -Task 'Build' |
Comment on lines
9
to
+10
| if (-not $env:BHProjectPath) { | ||
| Set-BuildEnvironment -Path "$PSScriptRoot/.." -Force | ||
| & "$PSScriptRoot\..\build.ps1" -Task 'Build' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Set-BuildEnvironmentwith a call to the build script in multiple test files.What this changes
Ensures that a build is run before a Pester test run. This help when invoking directly with Pester or via the VS Code Test tool.
Why
Closes #
Type of change
Checklist
Invoke-psake Analyzepasses locally with no new warningsInvoke-psake Testpasses locally on at least one platformCHANGELOG.mdupdated (required for any user-facing change)Additional notes